package com.ww.scm.service;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.ww.core.orm.Page;
import com.ww.core.orm.PropertyFilter;
import com.ww.scm.entity.mat.FinanceAccount; 
import com.ww.scm.repository.mat.FinanceAccountRepository;

//Spring Bean的标识.
@Component
// 默认将类中的所有函数纳入事务管理.
@Transactional
public class FinanceAccountManager {
	/*
	 * 日志类
	 */
	private static Logger logger = LoggerFactory.getLogger(FinanceAccountManager.class);

	/*
	 * 定义Repository
	 */
	private FinanceAccountRepository financeAccountRepository;
	
	/*
	 * 注入Repository
	 */
	@Autowired
	public void setFinanceAccountRepository(FinanceAccountRepository financeAccountRepository) {
		this.financeAccountRepository = financeAccountRepository;
	}
	
	@Transactional(readOnly = true)
	public FinanceAccount findFinanceAccount(String id){
		return financeAccountRepository.get(id);
	}
	
	@Transactional(readOnly = true)
	public Page<FinanceAccount> findPage(Page<FinanceAccount> page,List<PropertyFilter> filters){
		Page<FinanceAccount> financeAccountList=financeAccountRepository.findPage(page,filters);
		return financeAccountList;
	}
	
	@Transactional(readOnly = true)
	public List<FinanceAccount> findFinanceAccountList(List<PropertyFilter> filters){
		List<FinanceAccount> financeAccountList=financeAccountRepository.find(filters);
		return financeAccountList;
	}
	
	@Transactional(readOnly = true)
	public FinanceAccount findFinanceAccount(List<PropertyFilter> filters){
		FinanceAccount financeAccount=financeAccountRepository.findUnique(filters);
		return financeAccount;
	}


}
